<?php
#require_once('Imaging.php');
class Imaging_ResizeMode1 extends Imaging {

  function resize($max_w, $max_h){
    // Resize
    $src_w = $this->get_width();
    $src_h = $this->get_height();
    #echo("Source w: $src_w x $src_h - $max_w, $max_h\n");
    if($src_w > $max_w || $src_h > $max_h){
      $a= $max_w / $max_h;
      $b= $src_w / $src_h;
      if ( $a < $b ){ // source is 'wider' ( in term of w/h ratio)
        $this->resize_to_width($max_w);
      } else {
        $this->resize_to_height($max_h);
      }
      $this->resized = TRUE;
      return $this->get_dimension();
    }
    
    $this->resized = FALSE;
    return $this->get_dimension();
  } // end functin resize
}
?>